import { stringify } from 'qs';
import {request} from '../utils/request';
import { getConfig } from '../../config';
const config = getConfig();

//  当前维修信息列表--------------------------------------------------------------------
export async function queryRepairList(params) {
  return request('/repair/repairinfo/list', {
    method: 'POST',
    body: params,
  });
}


// 历史维修记录列表
export async function actionHistoryRepairList(params) {
  return request('/repair/repairinfo/queryHisList', {
    method: 'POST',
    body: params,
  });
}

// 添加维修
export async function actionRepairAdd(params) {
  return request('/repair/repairinfo/save', {
    method: 'POST',
    body: params,
  });
}

// 编辑维修
export async function actionRepairEdit(params) {
  return request('/repair/repairinfo/update', {
    method: 'POST',
    body: params,
  });
}



// 维修详情
export async function queryRepairInfo(params) {
  if (config.isMock) {
    return request(`/repair/repairinfo/info`, {
      method: 'POST',
      body: params,
    });
  }else{
    return request(`/repair/repairinfo/info/${params.repairId}`, {
      method: 'POST',
    });
  }
}

// 导出
export async function actionRepairExport(params) {
  return request(
    "05010006",
    {
      method: "POST",
      body: params
    },
    null,
    null,
    "download"
  );
}

// 维修处理详情
export async function queryRepairProcess(params) {
  return request('/repair/repairprocess/queryRepairProcess', {
    method: 'POST',
    body: params,
  });
}

// 维修提醒
export async function queryRepairRemind(params) {
  return request('/repair/repairinfo/repairRemindList', {
    method: 'POST',
    body: params,
  });
}

// 维修审核
export async function queryRepairExamine(params) {
  return request('/repair/repairinfo/repairCheck', {
    method: 'POST',
    body: params,
  });
}


// 维修验收
export async function queryRepairAcceptance(params) {
  return request('/repair/repairinfo/repairAcceptanceCheck', {
    method: 'POST',
    body: params,
  });
}


// 根据维修流程ID  检索备件
export async function queryProcessSpares(params) {
  return request('/device/deviceattauserecord/list', {
    method: 'POST',
    body: params,
  });
}


// 审核状态改变为审核中
export async function actionRepairStatusExamine(params) {
  return request('/repair/repairinfo/repairChecking', {
    method: 'POST',
    body: params,
  });
}

// 验收状态改变为验收中
export async function actionRepairStatusAcceptancee(params) {
  return request('/repair/repairinfo/repairAcceptanceChecking', {
    method: 'POST',
    body: params,
  });
}


// 查询区域树和设备节点的树结构数据
export async function queryDistrictAndDeviceTreeData(params) {
  return request('/repair/repairinfo/queryDistrictAndDeviceTreeData', {
    method: 'POST',
    body: params,
  });
}